Giriş Yapın veya Hesap Oluşturun

Giriş Yap

🚫 HESABINIZ GEÇİCİ OLARAK YASAKLANDI

Auto-clicker kullandığınız tespit edildi.

Süre: 10:00

`, 'default': `

🎲 Şans Oyunu

Zarı at ve şansını dene!

🎲
` }; // Oyun tipine göre template seç const lowerType = gameType.toLowerCase(); if (lowerType.includes('sayı') || lowerType.includes('tahmin')) { return templates['sayı tahmin']; } else { return templates['default']; } } // Kullanıcı verilerini güncelle async function updateUserData() { if (!currentUser) return; const updates = { coins: userCoins, dailyTaps: dailyTaps, lastTapReset: new Date().toDateString() }; try { await database.ref('users/' + currentUser.username).update(updates); currentUser = { ...currentUser, ...updates }; localStorage.setItem('tapswap_user', JSON.stringify(currentUser)); } catch (error) { console.error('Veri güncelleme hatası:', error); } } // Görevleri yükle async function loadTasks() { try { const tasksSnapshot = await database.ref('tasks').once('value'); const tasks = tasksSnapshot.val() || {}; const tasksList = document.getElementById('tasksList'); tasksList.innerHTML = ''; Object.keys(tasks).forEach(taskId => { const task = tasks[taskId]; const taskDiv = document.createElement('div'); taskDiv.className = 'task-item'; taskDiv.innerHTML = `
${task.title}
Ödül: ${task.reward} CTC
`; tasksList.appendChild(taskDiv); }); } catch (error) { console.error('Görevler yüklenemedi:', error); } } // Görevi tamamla async function completeTask(taskId, link, reward) { try { const completedTasksSnapshot = await database.ref('users/' + currentUser.username + '/completedTasks/' + taskId).once('value'); if (completedTasksSnapshot.exists()) { showNotification('Bu görevi zaten tamamladınız!', 'error'); return; } window.open(link, '_blank'); setTimeout(async () => { userCoins += reward; await database.ref('users/' + currentUser.username + '/completedTasks/' + taskId).set(true); updateUI(); updateUserData(); showNotification(`Görev tamamlandı! +${reward} CTC kazandınız!`, 'success'); loadTasks(); }, 5000); } catch (error) { showNotification('Görev tamamlanırken hata oluştu: ' + error.message, 'error'); } } // Reklamları yükle async function loadAds() { try { const adsSnapshot = await database.ref('ads').once('value'); const ads = adsSnapshot.val() || {}; const adsSection = document.getElementById('adsSection'); adsSection.innerHTML = ''; Object.keys(ads).forEach(adId => { const ad = ads[adId]; const adDiv = document.createElement('div'); adDiv.style.margin = '20px 0'; adDiv.innerHTML = ad.script; if (ad.location === 'top') { adsSection.parentNode.insertBefore(adDiv, adsSection.parentNode.firstChild); } else if (ad.location === 'middle') { adsSection.appendChild(adDiv); } else { adsSection.parentNode.appendChild(adDiv); } }); } catch (error) { console.error('Reklamlar yüklenemedi:', error); } } // Para çekme talebi async function requestWithdrawal() { const amount = parseFloat(document.getElementById('withdrawAmount').value); const method = document.getElementById('withdrawMethod').value; const account = document.getElementById('withdrawAccount').value; if (!amount || amount < 1) { showNotification('Minimum çekim miktarı 1 AZN\'dir!', 'error'); return; } if (!account) { showNotification('Lütfen hesap bilgisini girin!', 'error'); return; } const requiredCoins = amount * 1000; // 1000 CTC = 1 AZN if (userCoins < requiredCoins) { showNotification('Yetersiz bakiye!', 'error'); return; } try { const requestId = Date.now().toString(); const withdrawalRequest = { username: currentUser.username, amount: amount, method: method, account: account, requiredCoins: requiredCoins, status: 'pending', requestDate: new Date().toISOString() }; await database.ref('withdrawalRequests/' + requestId).set(withdrawalRequest); showNotification('Çekim talebi gönderildi! Admin onayı bekleniyor.', 'success'); document.getElementById('withdrawAmount').value = ''; document.getElementById('withdrawAccount').value = ''; } catch (error) { showNotification('Çekim talebi gönderilirken hata oluştu: ' + error.message, 'error'); } } // Admin fonksiyonları async function addTask() { if (!isAdmin) return; const title = document.getElementById('taskTitle').value; const link = document.getElementById('taskLink').value; const reward = parseInt(document.getElementById('taskReward').value); if (!title || !link || !reward) { showNotification('Lütfen tüm alanları doldurun!', 'error'); return; } try { const taskId = Date.now().toString(); await database.ref('tasks/' + taskId).set({ title: title, link: link, reward: reward }); showNotification('Görev başarıyla eklendi!', 'success'); document.getElementById('taskTitle').value = ''; document.getElementById('taskLink').value = ''; document.getElementById('taskReward').value = ''; loadTasks(); } catch (error) { showNotification('Görev eklenirken hata oluştu: ' + error.message, 'error'); } } async function addAd() { if (!isAdmin) return; const script = document.getElementById('adScript').value; const location = document.getElementById('adLocation').value; if (!script) { showNotification('Lütfen reklam script\'ini girin!', 'error'); return; } try { const adId = Date.now().toString(); await database.ref('ads/' + adId).set({ script: script, location: location }); showNotification('Reklam başarıyla eklendi!', 'success'); document.getElementById('adScript').value = ''; loadAds(); } catch (error) { showNotification('Reklam eklenirken hata oluştu: ' + error.message, 'error'); } } async function removeAds() { if (!isAdmin) return; try { await database.ref('ads').remove(); showNotification('Tüm reklamlar temizlendi!', 'success'); loadAds(); } catch (error) { showNotification('Reklamlar silinirken hata oluştu: ' + error.message, 'error'); } } async function loadWithdrawalRequests() { if (!isAdmin) return; try { const requestsSnapshot = await database.ref('withdrawalRequests').once('value'); const requests = requestsSnapshot.val() || {}; const requestsList = document.getElementById('withdrawalRequests'); requestsList.innerHTML = ''; Object.keys(requests).forEach(requestId => { const request = requests[requestId]; if (request.status === 'pending') { const requestDiv = document.createElement('div'); requestDiv.className = 'task-item'; requestDiv.innerHTML = `
${request.username}
${request.amount} AZN - ${request.method}
${request.account}
`; requestsList.appendChild(requestDiv); } }); } catch (error) { console.error('Çekim talepleri yüklenemedi:', error); } } async function approveWithdrawal(requestId) { if (!isAdmin) return; try { const requestSnapshot = await database.ref('withdrawalRequests/' + requestId).once('value'); const request = requestSnapshot.val(); if (request) { const userSnapshot = await database.ref('users/' + request.username).once('value'); const userData = userSnapshot.val(); if (userData && userData.coins >= request.requiredCoins) { await database.ref('users/' + request.username + '/coins').set(userData.coins - request.requiredCoins); await database.ref('withdrawalRequests/' + requestId + '/status').set('approved'); showNotification('Çekim talebi onaylandı!', 'success'); loadWithdrawalRequests(); } else { showNotification('Kullanıcının yetersiz bakiyesi var!', 'error'); } } } catch (error) { showNotification('Çekim onaylanırken hata oluştu: ' + error.message, 'error'); } } async function rejectWithdrawal(requestId) { if (!isAdmin) return; try { await database.ref('withdrawalRequests/' + requestId + '/status').set('rejected'); showNotification('Çekim talebi reddedildi!', 'success'); loadWithdrawalRequests(); } catch (error) { showNotification('Çekim reddedilirken hata oluştu: ' + error.message, 'error'); } } // UI Yardımcı fonksiyonlar function showGameScreen() { document.getElementById('authScreen').classList.add('hidden'); document.getElementById('gameScreen').classList.remove('hidden'); } function showLogin() { document.getElementById('loginForm').classList.remove('hidden'); document.getElementById('registerForm').classList.add('hidden'); } function showRegister() { document.getElementById('loginForm').classList.add('hidden'); document.getElementById('registerForm').classList.remove('hidden'); } function logout() { localStorage.removeItem('tapswap_user'); currentUser = null; userCoins = 0; dailyTaps = 0; document.getElementById('gameScreen').classList.add('hidden'); document.getElementById('adminPanel').classList.add('hidden'); document.getElementById('authScreen').classList.remove('hidden'); showLogin(); } function showNotification(message, type) { const notification = document.getElementById('notification'); notification.textContent = message; notification.className = 'notification'; if (type === 'error') { notification.style.background = '#f44336'; } else if (type === 'success') { notification.style.background = '#4CAF50'; } else if (type === 'info') { notification.style.background = '#2196F3'; } notification.style.display = 'block'; setTimeout(() => { notification.style.display = 'none'; }, 3000); } // Event Listeners document.addEventListener('keypress', function(e) { if (e.key === 'Enter') { if (!document.getElementById('authScreen').classList.contains('hidden')) { if (!document.getElementById('loginForm').classList.contains('hidden')) { login(); } else if (!document.getElementById('registerForm').classList.contains('hidden')) { register(); } } } }); window.addEventListener('beforeunload', function() { if (currentUser) { updateUserData(); } }); // Her 30 saniyede bir otomatik kayıt setInterval(() => { if (currentUser) { updateUserData(); } }, 30000);